package teaching.util;

/**
 * Author:20201002983_郑雨蓓
 * Date: 2024/3/3
 * Description:线程安全
 */
public class ThreadLocalUtil {
    //    public static final ThreadLocal THREAD_LOCAL = new ThreadLocal();
    private static final ThreadLocal<Object> THREAD_LOCAL = new ThreadLocal<>();

    //根据键获取值
    public static <T> T get() {
        return (T) THREAD_LOCAL.get();
    }

    public static void set(Object value) {
        THREAD_LOCAL.set(value);
    }

    public static void remove() {
        THREAD_LOCAL.remove();
    }

}
